home *** CD-ROM | disk | FTP | other *** search
- #include <btrvexp.h>
- #include <stdio.h>
- #include <conio.h>
- #include <string.h>
-
- main()
- {
- struct
- {
- char state[15];
- char areacode[3];
- char abbrev[2];
- } record;
-
- char inbuf[6];
-
- BSTART();
- while (TRUE)
- {
- inbuf[0] = 3;
- inbuf[1] = 0;
- printf("\n\nEnter a two-letter State Code: ");
- cgets(inbuf);
-
- if (inbuf[1] == 0)
- {
- printf("\n");
- BCLOSE(ALL_FILES);
- exit(0);
- }
-
- BGET(B_GE,"areacode.dat",2,&record,&inbuf[2]);
- if (BSTATUS == 0 && (strnicmp(record.abbrev,&inbuf[2],2) == 0) )
- {
- printf("\n\nArea Codes for %.15s\n",record.state);
- while (BSTATUS == 0 && (strnicmp(record.abbrev,&inbuf[2],2) == 0) )
- {
- printf("%.3s ",record.areacode);
- BGET(B_NEXT,"areacode.dat",2,&record,NULL);
- }
- }
- else
- printf("\n That is not a valid State Code");
- }
- }
-